<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function fileChange(){
            var reader = new FileReader();//定义文件读取流对象
            reader.readAsDataURL(document.getElementById("myFile").files[0]);
            reader.onload = function (ev) {
                document.getElementById("faceImg").src = ev.target.result;
            }
        }

    </script>
</head>
<body>
    <img id="faceImg" src="" width="200" height="200">
    <input type="file" onchange="fileChange()" id="myFile">
</body>
</html>